/*
 *  Netzpult - Your desk on the web
 *  Copyright (C) 2011  Ulrich Hilger, http://uhilger.de
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see http://www.gnu.org/licenses/
 */

package de.uhilger.netzpult.client;

import java.util.List;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

import de.uhilger.netzpult.shared.Document;
import de.uhilger.netzpult.shared.Folder;
import de.uhilger.netzpult.shared.GroupShare;
import de.uhilger.netzpult.shared.UserGroup;
import de.uhilger.netzpult.shared.UserShare;

/**
 * 
 * @author Copyright (c) Ulrich Hilger, http://uhilger.de
 * @author Published under the terms and conditions of
 * the <a href="http://www.gnu.org/licenses/" target="_blank">GNU General Public License</a>
 */
@RemoteServiceRelativePath("owner")
public interface OwnerService extends RemoteService, BoundTreeService {
	
	Folder createFolder(Folder folder) throws Exception;
	//List<Folder> getRootFolders() throws Exception;
	//List<Folder> getChildren(String owner, Folder folder) throws Exception;
	Folder updateFolder(Folder folder) throws Exception;
	void addToFolder(Folder folder, int documentId) throws Exception;
	void removeFromFolder(Folder folder, int documentId) throws Exception;
	String getParameter(String parameterName) throws Exception;
	
	List<UserShare> getUserShares(int docId);
	UserShare addUserShare(UserShare share);
	UserShare updateUserShare(UserShare share);
	UserShare deleteUserShare(UserShare share);
	
	List<GroupShare> getGroupShares(int docId);
	GroupShare addGroupShare(GroupShare share);
	GroupShare updateGroupShare(GroupShare share);
	GroupShare deleteGroupShare(GroupShare share);

	List<UserGroup> getUserGroups(String owner);
	UserGroup addUserGroup(UserGroup group);
	UserGroup updateUserGroups(UserGroup group);
	UserGroup deleteUserGroup(UserGroup group);
	
	void addUserToGroup(int groupId, String userId);
	void removeUserFromGroup(int groupId, String userId);
	
	Document createDocument(Document document) throws Exception;
	Document saveDraft(Document document) throws Exception;
	List<Document> getDocuments(String owner, Folder folder) throws Exception;
	List<Document> getUnfiledDocuments() throws Exception;
	List<Document> getDraftDocuments() throws Exception;
	List<Document> getSharedDocuments() throws Exception;
	Document getDocument(String id) throws Exception;
	int deleteDocument(int docId) throws Exception;
	
	Integer upFolder(int folderId) throws Exception;
	Integer downFolder(int folderId) throws Exception;
	Folder moveFolder(Folder folder, int newParentId) throws Exception;
	
	Integer upDocument(int folderId, int documentId) throws Exception;
	Integer downDocument(int folderId, int documentId) throws Exception;
	
	String reindex() throws Exception;

}
